package wangm.jwt;

import org.junit.Test;

import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.util.Base64;

public class JwtTest {



    @Test
    public void sha256Test() throws UnsupportedEncodingException {
//        System.out.println(encodeSHA256("hello"));
        System.out.println(new String(Base64.getEncoder().encode("sk123".getBytes()),"UTF-8"));
    }

    @Test
    public void encodingHeader() throws UnsupportedEncodingException {
        String header1 = "{\n" +
                "  'typ': 'JWT',\n" +
                "  'alg': 'HS256'\n" +
                "}";
        System.out.println(new String(Base64.getEncoder().encode(header1.getBytes()),"UTF-8"));
    }
}
